#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>

int main() {
    const char *fifoPath = "my_fifo";
    
    int fd = open(fifoPath, O_RDONLY); // 打开管道以读取数据

    char buffer[100];
    ssize_t bytesRead = read(fd, buffer, sizeof(buffer));

    if (bytesRead > 0) {
        buffer[bytesRead] = '\0';
        printf("Received message: %s\n", buffer);
    }
    close(fd); // 关闭文件描述符

    return 0;
}
